package com.hmdp.controller;

import com.hmdp.dto.Result;
import com.hmdp.entity.Captcha;
import com.hmdp.utils.CaptchaUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author ZhongTB
 * @create 2023-07-11 10:09
 */
@RestController
@RequestMapping("/captcha")
public class CaptchaController {
    @Autowired
    private CaptchaUtil captchaUtil;

    @GetMapping("/getCaptcha")
    public Result getCaptcha() throws IOException{
        Captcha captcha = captchaUtil.createCode();
        return Result.ok(captcha);
    }
}
